package com.xs.ai.entity;

import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import org.hibernate.annotations.Type;
import com.vladmihalcea.hibernate.type.json.JsonType;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

// ==========================================
// 日历事件实体
// ==========================================
@Data
@Entity
@Table(name = "calendar_events")
public class CalendarEvent {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    private Long userId;
    private String calendarId;
    
    @Column(unique = true, nullable = false)
    private String eventId;
    
    private String title;
    
    @Column(columnDefinition = "TEXT")
    private String description;
    
    private String location;
    private Boolean isOnline = false;
    private String meetingUrl;
    
    private LocalDateTime startTime;
    private LocalDateTime endTime;
    private String timezone;
    private Boolean isAllDay = false;
    
    private String organizerEmail;
    
    @Type(JsonType.class)
    @Column(columnDefinition = "jsonb")
    private List<Attendee> attendees;
    
    @Type(JsonType.class)
    @Column(columnDefinition = "jsonb")
    private List<String> requiredAttendees;
    
    @Enumerated(EnumType.STRING)
    private EventStatus status;
    
    @Enumerated(EnumType.STRING)
    private ResponseStatus userResponse;
    
    // AI分析
    private Double aiImportanceScore;
    private String aiCategory;
    private Boolean aiCanDelegate;
    private String aiSuggestedDelegate;
    private Boolean aiConflictDetected = false;
    private Integer aiTravelTimeMinutes;
    
    @Column(columnDefinition = "TEXT")
    private String aiPreparationNotes;
    
    private LocalDateTime aiAnalyzedAt;
    
    private String briefingDocumentUrl;
    
    @Type(JsonType.class)
    @Column(columnDefinition = "jsonb")
    private List<Long> relatedEmails;
    
    @Type(JsonType.class)
    @Column(columnDefinition = "jsonb")
    private List<Long> relatedTasks;
    
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
}